        <?
        require_once('header.php'); // uri  
        ?>
    
    <link rel="stylesheet" href="css/mainpage.css">
    <link rel="stylesheet" href="css/addbook.css">
    <link rel="stylesheet" href="css/datePicker.css">
    
    <link rel="stylesheet" href="css/kendo/kendo.common.min.css">
    <link rel="stylesheet" href="css/kendo/kendo.default.min.css">
    <link rel="stylesheet" media="all" type="text/css" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
    <link rel="stylesheet" media="all" type="text/css" href="js/timepicker/jquery-ui-timepicker-addon.css" />
    
    <script src="js/binaryajax.js"></script>
    <script src="js/exif.js"></script>
    <script src="js/canvasResize.js"></script>
    <script type="text/javascript" src="js/uploadbird.js"></script>
    <script type="text/javascript" src="js/uploadfilebird.js"></script>
    <script type="text/javascript" src="js/kendo.web.min.js"></script>
    <!--<script type="text/javascript" src="js/date.js"></script>
    <script type="text/javascript" src="js/jquery.datePicker.js"></script>-->

    <script type="text/javascript" src="http://code.jquery.com/ui/1.10.3/jquery-ui.min.js"></script>
    <script type="text/javascript" src="js/timepicker/jquery-ui-timepicker-addon.js"></script>
    <script type="text/javascript" src="js/timepicker/jquery-ui-sliderAccess.js"></script>

    
        <script>
    var checkaddbook=1;
    </script>
    
    
        <!--[if lt IE 7]>
            <p class="chromeframe">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">activate Google Chrome Frame</a> to improve your experience.</p>
        <![endif]-->
           
           <div class="wrpOuter">
            <div class="wrpPage">
        <?
        require_once('subheader.php'); // uri  
        ?>
                <div class="wrpOuterBody">
                    <div class="wrpBody clear">
                    <?
                    require_once('menu.php'); // uri  
                    
                    

                    ?>
                         <!-- contentlist -->
                        <div class="wrpOuterContentList">
                            <div class="wrpInnerContentlist">
                               <div class="wrpAddBookLoad">
                                    <div class="navTopBar">
                                        <h2 class="tabShowTopBar">เพิ่มเอกสารการประชุม</h2>
                                    </div>
                                    <div class="wrapCreateBookDP">
                                                <div class="wrapCreateBook">

                                                        <div class="wrapGenInfo">
                                                            <p class="textGenInfo titleGenInfo">ข้อมูลทั่วไป</p>
                                                            <div class="wrapTmbnlBook">
                                                                <div class="wrpInnerTmbBook" id="droppic">
                                                                    <img class="upThumImg" id="imgshelf" src="<?if($this->data['editbook']['book']['photo']){ echo imginfo."/".$this->data['editbook']['book']['shelfid'].'/'.$this->data['editbook']['book']['bookid'].'/'.$this->data['editbook']['book']['photo']; }else{?>img/thumnailbookdefault.jpg<?}?>" alt="upimage">
                                                                <p class="recommendTmbnlBook textUnderTumbnl">400 x 300 px</p>
                                                                <button class="btnAddTmbnl btnAddU" id="bookBtn" type="button">+ Thumbnail</button>
                                                                </div>
                                                            </div>
                                                            <div class="wrapTitleandDsctBook">
                                                            
                                                              <input class="inptTitleBook inptTiDesBook" id="topic" name="topic" value="<?=$this->data['editbook']['book']['topic']?>" type="text" placeholder="หัวข้อการประชุม"><span style="color: red;">*</span>
                                                                <input class="inptTitleBook inptTiDesBook" id="title" name="title" value="<?=$this->data['editbook']['book']['title']?>" type="text" placeholder="ชื่อประชุม"><span style="color: red;">*</span>
                                                                <textarea class="inptDsctShelf inptTiDesBook" id="description" name="description" placeholder="รายละเอียดการประชุม" ><?=$this->data['editbook']['book']['description']?></textarea>

                                                                <div class="wrapAddTag">
                                                                    <p>เลือกหน่วยงาน</p>
                                                                    <div class="tagList">
                                                                        <ul>
                                                                         <li>
                                                                                <div class="wrapCheck">
                                                                                    <input  checked="checked"  type="radio" name="tag[]" id="c0" value="" class="checkList">
                                                                                    <label for="c0">เลือกหน่วยงาน</label>
                                                                                </div>
                                                                            </li>
                                                                        <?
                                                                        $firstcheck=1;
                                                                            if(count($this->data['shelf']['tag']))
                                                                            {
                                                                            foreach($this->data['shelf']['tag'] as $valuetag)
                                                                            {
                                                                            $selected="";
                                                                            
                                                                            if(is_array($this->data['editbook']['tag']))
                                                                            {
                                                                            if(in_array($valuetag['tagid'],$this->data['editbook']['tag']))
                                                                            {
                                                                           $selected='checked="checked"'; 
                                                                            
                                                                            }
                                                                            $firstcheck=0;
                                                                            }else if($firstcheck)
                                                                            {
                                                                            //$selected='checked="checked"';
                                                                            $firstcheck=0;
                                                                            
                                                                            }
                                                                            
                                                                             ?>
  
                                                                            
                                                                            <li>
                                                                                <div class="wrapCheck">
                                                                                    <input <?=$selected?>  type="radio" name="tag[]" id="c<?=$valuetag['tagid']?>" value="<?=$valuetag['tagid']?>" class="checkList">
                                                                                    <label for="c<?=$valuetag['tagid']?>"><?=$valuetag['name']?></label>
                                                                                </div>
                                                                            </li>
                                                                             
                                                                             <?
                                                                            
                                                                            
                                                                            }
                                                                            
                                                                            
                                                                            }
                                                                    
                                                                    ?>
                                                                            
                                                                        </ul>
                                                                    </div>
                                                                </div><span style="color: red;">*</span>

                                                                <div class="wrapAddType" style="display: none;">
                                                                    <p>เลือก Type หนังสือ</p>
                                                                    <div class="typeList">
                                                                        <ul>
                                                                          <?
                                                                    if(count($this->data['shelf']['cat']))
                                                                    {
                                                                    foreach($this->data['shelf']['cat'] as $valuecat)
                                                                    {
                                                                    
                                                                    
                                                                     $selected='checked="checked"'; 
                                                                            
                                                                            if(is_array($this->data['editbook']['cat']))
                                                                            {
                                                                            if(in_array($valuecat['catid'],$this->data['editbook']['cat']))
                                                                            {
                                                                           $selected='checked="checked"'; 
                                                                            
                                                                            }
                                                                            }
                                                                            
                                                                    
                                                                     ?>
                                                                    <li>
                                                                                <div class="wrapCheck">
                                                                                    <input <?=$selected?> value="<?=$valuecat['catid']?>" name="cat[]" type="checkbox" id="d<?=$valuecat['catid']?>" class="checkList">
                                                                                    <label for="d<?=$valuecat['catid']?>"><?=$valuecat['name']?></label>
                                                                                </div>
                                                                            </li>
                                                                     <?
                                                                    
                                                                    
                                                                    }
                                                                    
                                                                    
                                                                    }
                                                                    
                                                                    ?>
                                                                           
                                                                        </ul>
                                                                    </div>
                                                                </div>

                                                                <input class="inptKey inptTiDesBook" id="keyword" name="keyword" value="<?=$this->data['editbook']['book']['keyword']?>" type="text" placeholder="Add Keywords - ex. #travel #place"><span style="color: red;">*</span>
                                                                
                                                                <div class="duration clearix">
    <div class="durationDate">
                                                                <input class="inptPrice inptTiDesBook" id="date" name="date" value="<? if($this->data['editbook']['book']['datedata']){ echo $this->data['editbook']['book']['datedata']; }?>" type="text" placeholder="วันที่การประชุม">

                                                               <!-- <input class="inptPrice inptTiDesBook" id="time" name="time" value="<? if($this->data['editbook']['book']['time']){  
                                                                list($h,$m,$s)=explode(":",$this->data['editbook']['book']['time1']) ;
                                                                echo $h.':'.$m;
                                                                
                                                                 }?>" type="text" placeholder="เริ่มตั้งแต่" style="width: 70px;">-->
                                                                  <span style="color: red;">*</span>
                                                                </div>
                                                                    <div class="durationTime">
        <div class="startTime">
            <span>เวลาเริ่มต้น</span>
                                                                <select name="hour1" id="hour1" >
                                                                
                                                                <option value="">เลือกชั่วโมง</option>
                                                                
                                                                
                                                                <?
                                                    
                                                                for($i=0;$i<24;$i++){
                                                                if($i==intval($h)&&isset($this->data['editbook']['book']['time1']))
                                                                {
                                                                ?>
                                                                <option selected="selected" value="<?=sprintf('%02d',$i)?>"><?=sprintf('%02d',$i)?></option>
                                                                <?
                                                                }else
                                                                {
                                                                ?>
                                                                
                                                                <option value="<?=sprintf('%02d',$i)?>"><?=sprintf('%02d',$i)?></option>
                                                                
                                                                
                                                              <?  }
                                                                
                                                                }?>
                                                                
                                                                </select>
                                                              
                                                                
                                                                
                                                                <select name="min1" id="min1" >
                                                                <option value="">เลือกนาที</option>
                                                                <?
                                                                $icheck=0;
                                                                for($i=0;$i<2;$i++){
                                                                if($icheck==intval($m)&&isset($this->data['editbook']['book']['time1']))
                                                                {
                                                                ?>
                                                                <option selected="selected" value="<?=sprintf('%02d',$icheck)?>"><?=sprintf('%02d',$icheck)?></option>
                                                                <?
                                                                }else
                                                                {
                                                                
                                                                
                                                                
                                                                ?>
                                                                
                                                                <option value="<?=sprintf('%02d',$icheck)?>"><?=sprintf('%02d',$icheck)?></option>
                                                                
                                                                
                                                              <?  }
                                                              
                                                                $icheck=$icheck+30;
                                                                }?>
                                                                
                                                                </select> 
                                                                 <span style="color: red;">*</span>
        </div>
        <div class="endTime">
        <span>เวลาสิ้นสุด</span>
                                                                
                                                              <!--  <input class="inptPrice inptTiDesBook" id="time2" name="time2" value="<? if($this->data['editbook']['book']['time2']){  
                                                                list($h,$m,$s)=explode(":",$this->data['editbook']['book']['time2']) ;
                                                                echo $h.':'.$m;
                                                                
                                                                 }?>" type="text" placeholder="ถึง" style="width: 70px;"><span style="color: red;">*</span>-->
                                                                 
                                                                 
                                                                 
                                                                 <select name="hour2" id="hour2" >
                                                                  <option value="">เลือกชั่วโมง</option>
                                                                <?
                                                    
                                                                for($i=0;$i<24;$i++){
                                                                if($i==intval($h)&&isset($this->data['editbook']['book']['time2']))
                                                                {
                                                                ?>
                                                                <option selected="selected" value="<?=sprintf('%02d',$i)?>"><?=sprintf('%02d',$i)?></option>
                                                                <?
                                                                }else
                                                                {
                                                                ?>
                                                                
                                                                <option value="<?=sprintf('%02d',$i)?>"><?=sprintf('%02d',$i)?></option>
                                                                
                                                                
                                                              <?  }
                                                                
                                                                }?>
                                                                
                                                                </select>
                                                                
                                                                
                                                                
                                                                <select name="min2" id="min2" >
                                                                <option  value="">เลือกนาที</option>
                                                                <?
                                                                $icheck=0;
                                                                for($i=0;$i<2;$i++){
                                                                if($icheck==intval($m)&&isset($this->data['editbook']['book']['time2']))
                                                                {
                                                                ?>
                                                                <option selected="selected"  value="<?=sprintf('%02d',$icheck)?>"><?=sprintf('%02d',$icheck)?></option>
                                                                <?
                                                                }else
                                                                {
                                                                ?>
                                                                
                                                                <option value="<?=sprintf('%02d',$icheck)?>"><?=sprintf('%02d',$icheck)?></option>
                                                                
                                                                
                                                              <?  }
                                                                 $icheck=$icheck+30;
                                                                }?>
                                                                
                                                                </select>                              <span style="color: red;">*</span>
        </div>
    </div>
</div>
                                                                <input class="inptPrice inptTiDesBook" style="margin-right: 10px;"  id="place" name="place" value="<?=$this->data['editbook']['book']['place'];?>" type="text" placeholder="สถานที่การประชุม">
                                                                
                                                                <input type="hidden" name="shelfid" id="shelfid" value="<?=$this->data['shelf']['shelfid']?>" >
                                                                <input type="hidden" name="bookid" id="bookid" value="<?=$this->data['editbook']['book']['bookid']?>" >
                                                                <div class="inptMode">
                                                                    <strong>การแสดงผล</strong>
                                                                    
                                                                    <input type="radio" value="2" id="status2" name="status" <?if($this->data['editbook']['book']['status']==2){?>checked="checked"<?}else if(!$this->data['editbook']['book']['status']){?>checked="checked"<?}?>><label>แสดงข้อมูล</label>
                                                                                                                                        
                                                                    <input type="radio" value="1" id="status1" name="status" <?if($this->data['editbook']['book']['status']==1){?>checked="checked"<?}?> ><label>ไม่แสดงข้อมูล</label>

                                                                </div>
                                                             <!--   <select id="userlist" name="userlist" data-placeholder="ตั้งค่าสิทธิใช้งาน" multiple="multiple">
                                                                 <?if(count($this->data['userlist'])){
                                                                     foreach($this->data['userlist'] as $valueuser){
                                                                     
                                                                     
                                                                      $selected="";
                                                                            
                                                                            if(is_array($this->data['editbook']['user']))
                                                                            {
                                                                            if(in_array($valueuser['userid'],$this->data['editbook']['user']))
                                                                            {
                                                                           $selected='selected="selected"'; 
                                                                            
                                                                            }
                                                                            }
                                                                 ?>
                                                                     <option <?=$selected?> value="<?=$valueuser['userid']?>"><? echo $valueuser['username'].' ('.$valueuser['email'].')';?></option>
                                                                 <?
                                                                     }
                                                                 }?>
                                                                </select>-->
                                                                <textarea placeholder="กรอก E-Mail ผู้ใช้งาน เพื่อให้สิทธิ์ในการเปิดอ่านเอกสาร เช่น test@thaihealth แล้วคั่นด้วยเครื่องหมาย , เพื่อใส่ E-mail คนถัดไป" id="userlist" class="inptDsctShelf inptTiDesBook" name="userlist"><?
                                                                
                                                                if(is_array($this->data['editbook']['email']))
                                                                {
                                                                echo join(",",$this->data['editbook']['email']); 
                                                                }
                                                                
                                                                
                                                                ?></textarea><span style="color: red;">*</span>
                                                               
                                                            </div>
                                                      
                                                        </div>
                                                        <div class="wrapDataInfo">
                                                            <p class="textDetailInfo">เอกสารการประชุม</p>
                                                            <div>อัพโหลดหลายไฟล์<input type="file" name="pdfdatamultiple" id="pdfdatamultiple" multiple accept="application/pdf,image/*" ></div>

                                                            
                                                            
                                                             <div class="wrapAddBook" style="display: none;">
                                                              <div class="addBook">  
                                                                
                                                                
                                                                <div class="wrapTumbnlDef4" id="zaveloop">
                                                                
                                                                <div class="upUIU2 fupUi" id="wrapZave">
                                                                

                                                                    <div class="wrapPdf wrapTmbnlFileType">
                                                                        <div class="widgetUp">
                                                                            <div class="wrpWGRG">
                                                                                <div class="btnClosewg" onclick="addzaveform()"></div>
                                                                                <div class="btnAddwg" ></div>
                                                                            </div>
                                                                            <div class="wrpWGThum">
                                                                                <div class="wrpInnerTmbBook">
                                                                                    <div id="imgfiletarget-1"><img  alt="upimage" src="img/thumnailbookdefault.jpg" class="upThumImg"></div>
                                                                                    <p class="recommendTmbnlBook textUnderTumbnl">300 x 300 px</p>
                                                                                    <button class="btnAddTmbnl btnAddB btnAddfile2">+ Thumbnail</button>
                                                                                </div>
                                                                                <input type="text" name="sortfile[]" value="1" id="zave-sort-1" placeholder="Book Order" class="sortWGBO">
                                                                                <input type="text" placeholder="Document Name"  id="zave-name-1" name="zavenamefile[]" class="sortWGDN">
                                                                                 
                                                                            </div>
                                                                        </div>
                                                                        <div class="wrapInPd">
                                                                            <div class="tmbnlFileType">
                                                                                <i class="bookTypeIcon"  >
                                                                                    <div id="zavefileload-1" class="zaveload1 loading zavetypeload"></div>
                                                                                    <div class="topRight"></div>
                                                                                    <div class="bottomLeft"></div>
                                                                                    <p class="bookType2 zavetypenow" id="zavefiletarget-1">ZAVE</p>
                                                                                </i>
                                                                                <button id="btnAddfile2" onclick="return false" class="btnAddfile2 btnAddF btnAddB">Select File</button>
                                                                                <button id="btnDelfile2" onclick="return false" class="btnDelfile2 btnAddD btnAddB">-</button>
                                                                            </div>


                                                                            <div class="tmbnlFileType">
                                                                                <i class="bookTypeIcon"  >
                                                                                    <div id="zavecfileload-1" class="zavecload1 loading zavectypeload"></div>
                                                                                    <div class="topRight"></div>
                                                                                    <div class="bottomLeft"></div>
                                                                                    <p class="bookType2 zavectypenow" id="zavecfiletarget-1">ZAVEC</p>
                                                                                </i>
                                                                                <button id="btnAddfile3" onclick="return false" class="btnAddfile3 btnAddF btnAddB">Select File</button>
                                                                                <button id="btnDelfile3" onclick="return false" class="btnDelfile3 btnAddD btnAddB">-</button>
                                                                            </div>
                                                                        
                                                                        
                                                                            <div class="tmbnlFileType">
                                                                                <i class="bookTypeIcon"  >
                                                                                    <div id="zavemfileload-1" class="zavemload1 loading zavemtypeload"></div>
                                                                                    <div class="topRight"></div>
                                                                                    <div class="bottomLeft"></div>
                                                                                    <p class="bookType2 zavemtypenow" id="zavemfiletarget-1">ZAVEM</p>
                                                                                </i>
                                                                                <button id="btnAddfile4" onclick="return false" class="btnAddfile4 btnAddF btnAddB">Select File</button>
                                                                                <button id="btnDelfile4" onclick="return false" class="btnDelfile4 btnAddD btnAddB">-</button>
                                                                            </div>
                                                                        </div>
                                                                   
                                                                    </div>

                                                                </div>
                                                                
                                                                
                                                                </div>
                                                                
                                                                
                                                                </div>
                                                                
                                                                <div class="recSugBar recBar">
                                                                        <p class="recommendFileType textUnderTumbnl">Select "ZAVE file" or "Image file" to upload your book.</p>
                                                                </div>
                                                            </div>
                                                             <div class="dotPageA" id="zavedotPage" style="display: none;">
                                                                 
                                                                    <div id="dotAPzave1" onclick="clickzaverownow('dotAPzave1')" class="dotOutA dotallzave  dotInA"></div>   

                                                                    
                                                             </div>

                                                        
                                                             
                                                             <div class="wrapAddBook">
                                                                <div class="addBook">  
                                                                    <div class="wrapTumbnlDef2" id="pdfloop">
                                                                        <div class="upUIU2 fupUi" id="wrapPdf">
                                                                            <div class="wrapPdf wrapTmbnlFileType">
                                                                                <div class="widgetUp">
                                                                                    <div class="wrpWGRG">
                                                                                        <div class="btnClosewg" onclick="addpdfform()"></div>
                                                                                        <div class="btnAddwg" ></div>
                                                                                    </div>
                                                                                    <div class="wrpWGThum">
                                                                                        <div class="wrpInnerTmbBook">
                                                                                            <div id="imgfiletarget-0"><img  alt="upimage" src="img/thumnailbookdefault.jpg" class="upThumImg"></div>
                                                                                            <p class="recommendTmbnlBook textUnderTumbnl">300 x 300 px</p>
                                                                                            <button class="btnAddTmbnl btnAddB btnAddfile1">+ Thumbnail</button>
                                                                                        </div>
                                                                                        <input type="text" name="sortfile[]" value="1" id="pdf-sort-0" placeholder="Book Order" class="sortWGBO">
                                                                                        <input type="text" placeholder="Document Name"  id="pdf-name-0" name="pdfnamefile[]" class="sortWGDN">
                                                                                         
                                                                                    </div>
                                                                                </div>
                                                                                <div class="wrapInPd">
                                                                                    <div class="tmbnlFileType">
                                                                                        <i class="bookTypeIcon" id="typefiletarget-0" >
                                                                                            <div id="pdffileload-0" class="load1 loading pdftypeload"></div>
                                                                                            <div class="topRight"></div>
                                                                                            <div class="bottomLeft"></div>
                                                                                            <p class="bookType1" id="filetarget-0">PDF</p>
                                                                                        </i>
                                                                                        <button id="btnAddfile1" onclick="return false" class="btnAddfile1 btnAddF btnAddB">Select File</button>
                                                                                        <button id="btnDelfile1" onclick="return false" class="btnDelfile1 btnAddD btnAddB">-</button>
                                                                                    </div>
                                                                                </div>
                                                                            </div>
                                                                        </div>
                                                                    </div>
                                                                </div>
                                                                <div class="recSugBar recBar">
                                                                        <p class="recommendFileType textUnderTumbnl">เลือก "ไฟล์ PDF" ในการอัพโหลดเอกสาร</p>
                                                                </div>
                                                            </div>
                                                             <div class="dotPageA" id="pdfdotPage">
                                                                    <div id="dotAPpdf1" onclick="clickpdfrownow('dotAPpdf1')" class="dotOutA dotallpdf  dotInA"></div>   
                                                             </div>

                                                        
                                                             
                                                             
                                                             
                                                             
                                                             <div class="wrapAddBook" style="display: none;">
                                                              <div class="addBook">  
                                                                
                                                                
                                                                <div class="wrapTumbnlDef3" id="mp4loop">
                                                                
                                                                <div class="upUIU2 fupUi" id="wrapMp4">
                                                                    <div class="wrapPdf wrapTmbnlFileType">
                                                                        <div class="widgetUp">
                                                                            <div class="wrpWGRG">
                                                                                <div class="btnClosewg" onclick="addmp4form()"></div>
                                                                                <div class="btnAddwg" ></div>
                                                                            </div>
                                                                            <div class="wrpWGThum">
                                                                                <div class="wrpInnerTmbBook">
                                                                                    <div id="imgfiletarget-2"><img  alt="upimage" src="img/thumnailbookdefault.jpg" class="upThumImg"></div>
                                                                                    <p class="recommendTmbnlBook textUnderTumbnl">300 x 300 px</p>
                                                                                    <button class="btnAddTmbnl btnAddB btnAddfile5">+ Thumbnail</button>
                                                                                </div>
                                                                                <input type="text" name="sortfile[]" value="3" id="mp4-sort-2" placeholder="Book Order" class="sortWGBO">
                                                                                <input type="text" placeholder="Document Name"  id="mp4-name-2" name="mp4namefile[]" class="sortWGDN"> 
                                                                            </div>
                                                                        </div>
                                                                        <div class="wrapInPd">
                                                                            <div class="tmbnlFileType">
                                                                                <i class="bookTypeIcon" id="typefiletarget-2" >
                                                                                    <div id="mp4fileload-2" class="load1 loading mp4typeload"></div>
                                                                                    <div class="topRight"></div>
                                                                                    <div class="bottomLeft"></div>
                                                                                    <p class="bookType1" id="filetarget-2">MP4</p>
                                                                                </i>
                                                                                <button id="btnAddfile5" onclick="return false" class="btnAddfile5 btnAddF btnAddB">Select File</button>
                                                                                <button id="btnDelfile5" onclick="return false" class="btnDelfile5 btnAddD btnAddB">-</button>
                                                                            </div>
                                                                        </div>
                                                                    </div>

                                                                </div>
                                                                
                                                                
                                                                </div>
                                                                
                                                                
                                                                </div>
                                                                
                                                                <div class="recSugBar recBar">
                                                                        <p class="recommendFileType textUnderTumbnl">Select "MP4 file" or "Image file" to upload your book.</p>
                                                                </div>
                                                            </div>
                                                             <div class="dotPageA" id="mp4dotPage" style="display: none;">
                                                                 
                                                                    <div id="dotAPmp41" onclick="clickmp4rownow('dotAPmp41')" class="dotOutA dotallmp4  dotInA"></div>   

                                                                    
                                                             </div>

                                                        
                                                            
                                                        
                                                        
                                                        </div>
                                                        <div class="wrapBtnCreateBook">
                                                            <button class="btnCreateB" onclick="savebook()"><?if($this->data['editbook']){?>Save<?}else{?>สร้างเอกสารการประชุม<?}?> </button><?if($this->data['editbook']){?><button class="btnDelB" onclick="removebook()">Delete</button><?}?>
                                                        </div>

                                                </div>
                                    </div>
                                    <script type="text/javascript" src="js/addbook.js"></script> 

                               </div>
                            </div>
                        </div>
                    
                    </div>
                </div>
            </div>
        </div>
        <?if($this->data['editbook']){
        
       

        
        ?>
        <script>
        $(function() {
        <?if($this->data['editbook']['book']['photo']){?>
        $("#filebirdsavename-0").val('<?=$this->data['editbook']['book']['photo']?>');
        <?}
      
        
      
        
        ?>
        
       
        
        <?if($this->data['editbook']['book']['filearr']){
           $zavefirst=1;
           $pdffirst=1;
           $mp4first=1;
           
           $startzave=1;
           $row=3;
           foreach($this->data['editbook']['book']['filearr'] as $valefilearr){
           
           
           if($valefilearr['typeid']==4||$valefilearr['typeid']==2||$valefilearr['typeid']==3)
           {  
                
               if($zavefirst==0)
              {
                  if($startzave==1)
                 {
                 ?>
                 addzaveform(1);
                 <?
                 
                 }
                 
              
                 ?>
                   
                 <?
               
               
                if($valefilearr['img']!="")
                {
                ?>
                $("#imgfiletarget-<?=$row?>").html('<img class="upThumImg" src="<?=$valefilearr['img']?>" alt="upimage">');
                
                
                <?
                }else
                {
                
                ?>
                $("#imgfiletarget-<?=$row?>").html('<img class="upThumImg" src="img/thumnailbookdefault.jpg" alt="upimage">');
                
                <? 
                
                }
                
                ?>
                $("#file2imgbirdsavename-<?=$row?>").val('<?=$valefilearr['img2']?>');
                $("#<?=$valefilearr['filetype2']?>file2birdsavename-<?=$row?>").val('<?=$valefilearr['file2']?>');
                $("#<?=$valefilearr['filetype2']?>filetarget-<?=$row?>").html('<a href="<?=$valefilearr['file']?>" target="_blank"><?=$valefilearr['filetype']?></a>');
                $("#<?=$valefilearr['filetype2']?>fileload-<?=$row?>").show();
                $("#<?=$valefilearr['filetype2']?>fileload-<?=$row?>").css("height",81);
                $("#zave-name-<?=$row?>").val('<?=$valefilearr['name']?>');
                $("#zave-sort-<?=$row?>").val('<?=$valefilearr['group']?>');
                <?
                    $startzave++;
                 if($startzave==4)
                 {
                 $zavefirst=0;
                 $startzave=1;
                 $row++;
                 }
                 
               
               }
               
               else
               {
               
               
               
                if($valefilearr['img']!="")
                {
                ?>
                $("#imgfiletarget-1").html('<img class="upThumImg" src="<?=$valefilearr['img']?>" alt="upimage">');
                
                
                <?
                }else
                {
                
                ?>
                
               $("#imgfiletarget-1").html('<img class="upThumImg" src="img/thumnailbookdefault.jpg" alt="upimage">');  
                <? 
                
                }
                
                ?>
                $("#file2imgbirdsavename-1").val('<?=$valefilearr['img2']?>');
                $("#<?=$valefilearr['filetype2']?>file2birdsavename-1").val('<?=$valefilearr['file2']?>');
                $("#<?=$valefilearr['filetype2']?>filetarget-1").html('<a href="<?=$valefilearr['file']?>" target="_blank"><?=$valefilearr['filetype']?></a>');
                $("#<?=$valefilearr['filetype2']?>fileload-1").show();
                $("#<?=$valefilearr['filetype2']?>fileload-1").css("height",81);
                $("#zave-name-1").val('<?=$valefilearr['name']?>');
                $("#zave-sort-1").val('<?=$valefilearr['group']?>');
                <?
               
                  $startzave++;
                 if($startzave==4)
                 {
                 $startzave=1;
                 $zavefirst=0;
                 //$row++;
                 }
               
               
               }
            
            
            
           
           
           }
           else if($valefilearr['typeid']==1)
           {
               if($pdffirst==0)
               {
                ?>
                
                addpdfform(1);
                
                <?
               
               
                if($valefilearr['img']!="")
                {
                ?>
                $("#imgfiletarget-<?=$row?>").html('<img class="upThumImg" src="<?=$valefilearr['img']?>" alt="upimage">');
                
                
                <?
                }else
                {
                
                ?>
                $("#imgfiletarget-<?=$row?>").html('<img class="upThumImg" src="img/thumnailbookdefault.jpg" alt="upimage">');
                
                <? 
                
                }
                
                ?>
                $("#file2imgbirdsavename-<?=$row?>").val('<?=$valefilearr['img2']?>');
                $("#file2birdsavename-<?=$row?>").val('<?=$valefilearr['file2']?>');
                $("#filetarget-<?=$row?>").html('<a href="<?=$valefilearr['file']?>" target="_blank"><?=$valefilearr['filetype']?></a>');
                $("#<?=$valefilearr['filetype2']?>fileload-<?=$row?>").show();
                $("#<?=$valefilearr['filetype2']?>fileload-<?=$row?>").css("height",81);
                $("#<?=$valefilearr['filetype2']?>-name-<?=$row?>").val('<?=$valefilearr['name']?>');
                $("#<?=$valefilearr['filetype2']?>-sort-<?=$row?>").val('<?=$valefilearr['group']?>');
                <?
               
             
               $row++;
               
               }
           
               else
               {
               
               
               
                if($valefilearr['img']!="")
                {
                ?>
                $("#imgfiletarget-0").html('<img class="upThumImg" src="<?=$valefilearr['img']?>" alt="upimage">');
                
                
                <?
                }else
                {
                
                ?>
               $("#imgfiletarget-0").html('<img class="upThumImg" src="img/thumnailbookdefault.jpg" alt="upimage">'); 
                
                <? 
                
                }
                
                ?>
                
                $("#file2imgbirdsavename-0").val('<?=$valefilearr['img2']?>');
                $("#file2birdsavename-0").val('<?=$valefilearr['file2']?>');
                $("#filetarget-0").html('<a href="<?=$valefilearr['file']?>" target="_blank"><?=$valefilearr['filetype']?></a>');
                $("#<?=$valefilearr['filetype2']?>fileload-0").show();
                $("#<?=$valefilearr['filetype2']?>fileload-0").css("height",81);
                $("#<?=$valefilearr['filetype2']?>-name-0").val('<?=$valefilearr['name']?>');
                $("#<?=$valefilearr['filetype2']?>-sort-0").val('<?=$valefilearr['group']?>');
                <?
               
             
               
               
               }
           
           $pdffirst=0;
         //  $row++;
           }
           else if($valefilearr['typeid']==5)
           {
           if($mp4first==0)
           {
                ?>
                
                addmp4form(1);
                
                <?
               
               
                if($valefilearr['img']!="")
                {
                ?>
                $("#imgfiletarget-<?=$row?>").html('<img class="upThumImg" src="<?=$valefilearr['img']?>" alt="upimage">');
                
                <?
                }else
                {
                
                ?>
                $("#imgfiletarget-<?=$row?>").html('<img class="upThumImg" src="img/thumnailbookdefault.jpg" alt="upimage">');
                
                
                <? 
                
                }
                
                ?>
                $("#file2imgbirdsavename-<?=$row?>").val('<?=$valefilearr['img2']?>');
                $("#file2birdsavename-<?=$row?>").val('<?=$valefilearr['file2']?>');
                $("#filetarget-<?=$row?>").html('<a href="<?=$valefilearr['file']?>" target="_blank"><?=$valefilearr['filetype']?></a>');
                $("#<?=$valefilearr['filetype2']?>fileload-<?=$row?>").show();
                $("#<?=$valefilearr['filetype2']?>fileload-<?=$row?>").css("height",81);
                $("#<?=$valefilearr['filetype2']?>-name-<?=$row?>").val('<?=$valefilearr['name']?>');
                $("#<?=$valefilearr['filetype2']?>-sort-<?=$row?>").val('<?=$valefilearr['group']?>');
                <?
               
             
            $row++;   
               
               }
           else
           {
               
               
               
                if($valefilearr['img']!="")
                {
                ?>
                
                $("#imgfiletarget-2").html('<img class="upThumImg" src="<?=$valefilearr['img']?>" alt="upimage">');
                
                <?
                }else
                {
                
                ?>
                
                
                $("#imgfiletarget-2").html('<img class="upThumImg" src="img/thumnailbookdefault.jpg" alt="upimage">');
                
                <? 
                
                }
                
                ?>
                $("#file2imgbirdsavename-2").val('<?=$valefilearr['img2']?>');
                $("#file2birdsavename-2").val('<?=$valefilearr['file2']?>');
                $("#filetarget-2").html('<a href="<?=$valefilearr['file']?>" target="_blank"><?=$valefilearr['filetype']?></a>');
                $("#<?=$valefilearr['filetype2']?>fileload-2").show();
                $("#<?=$valefilearr['filetype2']?>fileload-2").css("height",81);
                $("#<?=$valefilearr['filetype2']?>-name-2").val('<?=$valefilearr['name']?>');
                $("#<?=$valefilearr['filetype2']?>-sort-2").val('<?=$valefilearr['group']?>');
                <?
               
             
               
               
               }
           
           
            $mp4first=0;
            
           }
           
           }
        }?>
        
        
        <? if($this->data['editbook']['book']['datedata']){?>  $('#date').val('<?=$this->data['editbook']['book']['datedata']?>'); <?}?>
        
         });
        </script>
        <?}?>

       <?
        require_once('footer.php'); // uri  
        ?>